Optimal. Leaf size=103 \[ a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \tan (c+d x)}{3 d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4142, 4133,
3855, 3852, 8} \begin {gather*} \frac {\left (2 C \left (a^2+b^2\right )+3 A b^2\right ) \tan (c+d x)}{3 d}+a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a b C \tan (c+d x) \sec (c+d x)}{3 d}+\frac {C \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4133
Rule 4142
Rubi steps
\begin {align*} \int (a+b \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \, dx &=\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \sec (c+d x)) \left (3 a A+b (3 A+2 C) \sec (c+d x)+2 a C \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{6} \int \left (6 a^2 A+6 a b (2 A+C) \sec (c+d x)+2 \left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 A x+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+(a b (2 A+C)) \int \sec (c+d x) \, dx+\frac {1}{3} \left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \int \sec ^2(c+d x) \, dx\\ &=a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \tan (c+d x)}{3 d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(242\) vs. \(2(103)=206\).
time = 1.29, size = 242, normalized size = 2.35 \begin {gather*} \frac {\sec ^3(c+d x) \left (9 a \cos (c+d x) \left (a A (c+d x)-b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+3 a \cos (3 (c+d x)) \left (a A (c+d x)-b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+2 \left (3 A b^2+3 a^2 C+4 b^2 C+6 a b C \cos (c+d x)+\left (3 A b^2+3 a^2 C+2 b^2 C\right ) \cos (2 (c+d x))\right ) \sin (c+d x)\right )}{12 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 117, normalized size = 1.14
method | result | size |
derivativedivides | \(\frac {A \,b^{2} \tan \left (d x +c \right )-b^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) | \(117\) |
default | \(\frac {A \,b^{2} \tan \left (d x +c \right )-b^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) | \(117\) |
norman | \(\frac {a^{2} A x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a^{2} A x +\frac {4 \left (3 A \,b^{2}+3 a^{2} C +b^{2} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {2 \left (A \,b^{2}+a^{2} C -a b C +b^{2} C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 \left (A \,b^{2}+a^{2} C +a b C +b^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+3 a^{2} A x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a^{2} A x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\frac {a b \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a b \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) | \(231\) |
risch | \(a^{2} A x -\frac {2 i \left (3 C a b \,{\mathrm e}^{5 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 C b a \,{\mathrm e}^{i \left (d x +c \right )}-3 A \,b^{2}-3 a^{2} C -2 b^{2} C \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {2 b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{d}+\frac {b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {2 b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{d}-\frac {b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}\) | \(232\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 129, normalized size = 1.25 \begin {gather*} \frac {6 \, {\left (d x + c\right )} A a^{2} + 2 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C b^{2} - 3 \, C a b {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 6 \, C a^{2} \tan \left (d x + c\right ) + 6 \, A b^{2} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.12, size = 136, normalized size = 1.32 \begin {gather*} \frac {6 \, A a^{2} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, A + C\right )} a b \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, A + C\right )} a b \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (3 \, C a b \cos \left (d x + c\right ) + C b^{2} + {\left (3 \, C a^{2} + {\left (3 \, A + 2 \, C\right )} b^{2}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{6 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 262 vs.
\(2 (97) = 194\).
time = 0.50, size = 262, normalized size = 2.54 \begin {gather*} \frac {3 \, {\left (d x + c\right )} A a^{2} + 3 \, {\left (2 \, A a b + C a b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, A a b + C a b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.69, size = 209, normalized size = 2.03 \begin {gather*} \frac {2\,A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,b^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {2\,C\,b^2\,\sin \left (c+d\,x\right )}{3\,d\,\cos \left (c+d\,x\right )}+\frac {C\,b^2\,\sin \left (c+d\,x\right )}{3\,d\,{\cos \left (c+d\,x\right )}^3}+\frac {C\,a\,b\,\sin \left (c+d\,x\right )}{d\,{\cos \left (c+d\,x\right )}^2}-\frac {A\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,4{}\mathrm {i}}{d}-\frac {C\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________